/*
 *  distanceScene.h
 *  opencvExample
 *
 *  Created by ycam on 11/03/04.
 *  Copyright 2011 __MyCompanyName__. All rights reserved.
 *
 */

#pragma once
#include "ofMain.h"
#include "basePattern.h"


class distanceScene : public basePattern{
public:
	void setup(){
		char tmpval;
		allocate();
		posCenter.set(0, 0);
		//		numCheck = 8;	
		numCheckX = 8;
		numCheckY = 8;		
		for (int i = 0; i < h; i++){
			for (int j = 0; j < w; j++){
				
				posNorm.x = j/(float)(w-1);
				posNorm.y = i/(float)(h-1);
				float dist = posNorm.distance(posCenter);
				tmpval = dist*maxGray;
				
				currentColorPixels[(i*w+j)*3 + 0] = tmpval;
				currentColorPixels[(i*w+j)*3 + 1] = tmpval;
				currentColorPixels[(i*w+j)*3 + 2] = tmpval;		
			}
		}
	}
	void update(){
		for (int i = 0; i < h; i++){
			for (int j = 0; j < w; j++){
			}
		}
		currentColorImage.setFromPixels(currentColorPixels, w, h);	
		count++;
	}
	void setupWhenPatternChanged(){
		count = 0;
	}
	int count;
	ofVec2f posNorm;
	ofVec2f	posCenter;
	
	int numCheckX,numCheckY;
};